﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ModelLayer;

namespace DBLayer
{
    public class SaleDBDummy: ISaleDB
    {
        Sale testSale;
        Sale testSale2;
        int currentId = 0;

        public SaleDBDummy()
        {
            testSale = CreateTestSale();
        }

        public Sale CreateTestSale()
        {
            Cinema cinema = new Cinema("biffen", "her");
            string[] actors = { "actor1", "actor2", "actor3" };
            DateTime d1 = new DateTime(2012, 10, 15);
            DateTime d2 = new DateTime(2012, 11, 20);
            Room room = new Room("1", 100, cinema);
            Movie movie = new Movie(true, "Title", 200, "actors", 15, "Blargh", "PG:13", "Steven Spegepølse", "Komedie", "Swahili", 9001, "Gerbal Rentals", d1, d2);
            Show show = new Show(movie, room, d2, 70);
            Person a = new Person("Lars", "Petersen", "111111");
            Sale s1 = new Sale(85, show, a, false, d1, 2);

            return s1;
        }

        public int InsertSale(Sale s)
        {
            testSale = s;
            currentId++;
            testSale.SaleID = currentId;
            return currentId;
        }

        public Sale GetSale(int id)
        {
            return testSale;
        }

        public int DeleteSale(int id)
        {
            testSale = null;
            return 1;
        }

        public int UpdateSale(Sale s)
        {
            testSale = s;
            return 1;
        }

        public List<Sale> GetUnpaidSales(string s)
        {
            return null;
            //if (testSale.Person.Telephone.Equals(s))
            //{
            //    return testSale;
            //}
            //else
            //{
            //    return null;
            //}

        }

        public List<Sale> GetSalesByShow(Show s)
        {
            return new List<Sale>();
        }

    }
}
